# cpp-stub 开关
set(cpp_stub_enable OFF)
# mockcpp 开关
set(mockcpp_enable OFF)

set(testLibs)
set(testLibDirs)

###########################
# gtest源码 或静态库
###########################
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/middlewares/gtest/lib/libgtest.a)
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/middlewares/gtest/googletest/include)
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/middlewares/gtest/googlemock/include)
    set(testLibDirs ${testLibDirs} ${CMAKE_CURRENT_SOURCE_DIR}/middlewares/gtest/lib/)
else()
    add_subdirectory(middlewares/gtest)  # 不用添加头文件路径，也不用链接静态库
endif()
set(testLibs ${testLibs} gtest gtest_main gmock gmock_main)

###########################
# Mockcpp 静态库
###########################
if(mockcpp_enable)
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/middlewares/mockcpp/include)
    set(testLibs ${testLibs} mockcpp)
    set(testLibDirs ${testLibDirs} ${CMAKE_CURRENT_SOURCE_DIR}/middlewares/mockcpp/lib)
endif(mockcpp_enable)

###########################
# 包含 cpp-stub 头文件
###########################
if(cpp_stub_enable)
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/middlewares/cpp-stub/src)
endif(cpp_stub_enable)

link_directories(${testLibDirs})

# 包含测试源码
add_subdirectory(dev_test)